import { Quill } from "vue-quill-editor";
const BlockEmbed = Quill.import('blots/block/embed')

class ImageBlot extends BlockEmbed {
  static create (value) {
    let node = super.create()
    node.setAttribute('src', value.url)
    node.setAttribute('alt', value.alt)
    node.setAttribute('title', value.alt)
    node.setAttribute('style',value.style)
    node.setAttribute('width', value.width)
    node.setAttribute('height', value.height)
    return node;
  }
 
  static value (node) {
    return {
      url: node.getAttribute('src'),
      style:node.getAttribute('style'),
      width: node.getAttribute('width'),
      height: node.getAttribute('height')
    };
  }
}

export default ImageBlot